#!/bin/sh

echo -n "Choose PREFIX (/usr): "
read PREFIX
[ "$PREFIX" = "" ] && PREFIX="/usr"
export PREFIX="$PREFIX"
if [ ! -d "$PREFIX" ];then
 echo "ERROR: $PREFIX does not exist!"
 exit 1
fi
echo "Installing scripts into $PREFIX/bin"
[ ! -d ${PREFIX}/bin ] && mkdir -p ${PREFIX}/bin
cat bin/pupx | sed "s*XXXX*$PREFIX*g" > ${PREFIX}/bin/pupx
[ ! -d ${PREFIX}/share/pupx/locale ] && mkdir -p ${PREFIX}/share/pupx/locale
for PO in `ls share/locale | grep .po`
do
 cp -af share/locale/$PO ${PREFIX}/share/pupx/locale/$PO
done
cp -af share/pupx.desktop ${PREFIX}/share/applications/pupx.desktop
